#include <iostream>
#include <vector>
#include "Mylist.hpp"
using namespace std;

class A
{
public:
    A(int n = 0)
    {
        cout << "A()" << endl;
        _pi = new int(n);
    }

    A(const A &a)
    {
        cout << "A(const A &a)" << endl;
        _pi = new int;
        *_pi = *a._pi;
    }

    A(A &&a)
    {
        cout << "A(A &&a)" << endl;
        _pi = a._pi;
        a._pi = nullptr;
    }

    ~A()
    {
        cout << "~A()" << endl;
        delete _pi;
    }

private:
    int *_pi;
};

template <class T>
class B
{
public:
    B()
    {
        cout << "B()" << endl;
    }
    B(const B &b) = delete;
    B(B &&b)
    {
        cout << "B(B &&b)" << endl;
    }

private:
    T _data;
};

template <class T>
int Compare(T &&a, T &&b)
{
    return a - b;
}

int main()
{
    // vector<A> arr = {1, 2, 3, 4, 5, 6};
    // Mylist<A> lt1(arr.begin(), arr.end());
    // Mylist<A> lt2(lt1);

    // B<int> b1;
    // B<int> b2(b1);
    // B<int> b2(move(b1));

    // double a = 2.86, b = 9.26;
    // cout << Compare<double> (a, b) << endl;   // 左值
    // cout << Compare(40, 12) << endl; // 右值
    // cout << Compare<int>(30, 20) << endl; 
}